package com.ncloud.system.entity;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.NotNull;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.ncloud.common.utils.DateUtils;

@SuppressWarnings("serial")
public class UserAuth implements Serializable{
	
	@JSONField(serializeUsing = ToStringSerializer.class)
	@NotNull
	private Long userId;
	
	@NotNull
	private String authCode;
	
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	@NotNull
	private Date effDate;
	
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	@NotNull
	private Date expDate;
	
	public UserAuth(Long userId, String authCode) {  
        this.userId = userId;  
        this.authCode = authCode;
        this.effDate = new Date();
        this.expDate = DateUtils.addDays(effDate, 1);
    }

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getAuthCode() {
		return authCode;
	}

	public void setAuthCode(String authCode) {
		this.authCode = authCode;
	}

	public Date getEffDate() {
		return effDate;
	}

	public void setEffDate(Date effDate) {
		this.effDate = effDate;
	}

	public Date getExpDate() {
		return expDate;
	}

	public void setExpDate(Date expDate) {
		this.expDate = expDate;
	}
	
}
